-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix memory tracking of ES|QL sample agg #128467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Pinging @elastic/ml-core (Team:ML) |
ivancea
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! LGTM!
| BytesRefBlock bytesRefBlock = (BytesRefBlock) block; | ||
| try ($Type$Block.Builder $type$Block = driverContext.blockFactory().new$Type$BlockBuilder(bytesRefBlock.getPositionCount())) { | ||
| try ( | ||
| block; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: What about moving the cast inside the try? So we avoid this extra block;. Not much of an improvement, but I think it makes the intent a bit clearer ("Now we'll consume this block, which is a BytesRefBlock"), and we use both variables from here on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
Maybe it's slightly obscure that handles closing the original block.
Anyway, it also conveniently solves my spotless/autogen issue (see the autocommit). Depending the the strlen of the type (Int or BytesRef), this block should go on 1 or 2 lines right now.
* Fix memory tracking of ES|QL sample agg * [CI] Auto commit changes from spotless * polish code --------- Co-authored-by: elasticsearchmachine <[email protected]>
* Fix memory tracking of ES|QL sample agg * [CI] Auto commit changes from spotless * polish code --------- Co-authored-by: elasticsearchmachine <[email protected]>
* Fix memory tracking of ES|QL sample agg * [CI] Auto commit changes from spotless * polish code --------- Co-authored-by: elasticsearchmachine <[email protected]>
* Fix memory tracking of ES|QL sample agg * [CI] Auto commit changes from spotless * polish code --------- Co-authored-by: elasticsearchmachine <[email protected]>
* ES|QL SAMPLE aggregation function (#127629) * ES|QL SAMPLE aggregation function * [CI] Auto commit changes from spotless * ThreadLocalRandom -> SplittableRandom * Update docs/changelog/127629.yaml * fix yaml test * Add SampleTests * docs + example * polish code * mark generated imports * comment with algorith description * use Randomness.get() * close properly * type checks * reuse hash * regen some files * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]> * Fix + unmute SampleTests (#127959) * Fix memory tracking of ES|QL sample agg (#128467) * Fix memory tracking of ES|QL sample agg * [CI] Auto commit changes from spotless * polish code --------- Co-authored-by: elasticsearchmachine <[email protected]> * ESQL: Unclean generated imports (#127723) This removes a ton of the tricky juggling we do for generated java files to keep the imports in order. Instead, we just live with them being out of order a little. It's not great, but it's so so so much easier than the terrible juggling we had been doing. * ESQL: Disable format checks on generated imports (#127648) This builds the infrastructure to disable spotless and some checkstyle rules on generated imports. This works around the most frustrating part of ESQL's string template generated files - the imports. It allows unused and out of order imports. This can let us remove a lot of cumbersome, tricky, and fairly useless `$if$` blocks from the templates. --------- Co-authored-by: elasticsearchmachine <[email protected]> Co-authored-by: Nik Everett <[email protected]>
fixes #128024